package com.anne.fish.dao.hibernate;

import java.util.List;

import com.anne.fish.model.Area;
import com.anne.fish.dao.AreaDao;
import com.anne.fish.dao.hibernate.GenericDaoHibernate;
import org.springframework.stereotype.Repository;

@Repository("areaDao")
public class AreaDaoHibernate extends GenericDaoHibernate<Area, Long> implements AreaDao {

    public AreaDaoHibernate() {
        super(Area.class);
    }
    
    public List<Area> findByParentId(Long pid) {
        return getHibernateTemplate().find("from Area u where u.fatherId=?",pid);
    }

	@Override
	public List<Area> getAll() {
		return getHibernateTemplate().find("from Area u order by prefix ");
	}
}
